package ru.dc.object.commands;

/**
 * <pre>
 * User: Penkov Vladimir
 * Date: 08.10.2010
 * Time: 16:15:49
 * </pre>
 */
public class HubName extends Command {

    private String hubname;

    @Override
    public String getActualCommandName() {
        return "$HubName";
    }

    @Override
    public String generateCommand() {
        return getActualCommandName()+" "+getHubname();
    }

    @Override
    public void parseCommand() {
        if (getCommand().length()>9) {
            setHubname(getCommand().substring(9));
        }
        else {
            setHubname(null);
        }
    }

    public String getHubname() {
        return hubname;
    }

    public void setHubname(String hubname) {
        this.hubname = hubname;
    }

    @Override
    public String toString() {
        return "HubName{" +
                "hubname='" + hubname + '\'' +
                '}';
    }
}
